package com.lunesu.bjair;

import android.app.Service;
import android.content.Intent;
import android.os.IBinder;

/** This service is used by the AppWidgetProvider. It is needed to keep
 * the app-widget responsive. The service will update the widget when done.
 * @author Lionello
 *
 */
public class BeijingAirUpdateService extends Service {

	@Override
	public void onStart(Intent intent, int startId) {
	    super.onStart(intent, startId);
	    
		String url = this.getString(R.string.bjair_url);
	    int airquality = BeijingAirAppWidgetProvider.getAirQuality(url, null);
		// Update the app-widget
		BeijingAirAppWidgetProvider.updateWidget(this, airquality);
	}

	@Override
	public IBinder onBind(Intent intent) {
	    // We don't need to bind to this service
	    return null;
	}
}
